<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
  <meta name="generator" content=
  "HTML Tidy for Linux/x86 (vers 1 September 2005), see www.w3.org">

  <title>C++ Vectors</title>
  <link href="../cppreference.css" rel="stylesheet" type="text/css">
</head>

<body>
<table>
  <tr>
  <td>
  <div class="body-content">

  <div class="header-box">
    <a href="../index.html">cppreference.com</a> &gt; <a href=
    "index.html">C++ Vectors</a>
  </div>

  <div class="name-format">
    C++ Vectors
  </div>

  <p>Vectors contain contiguous elements stored as an array. Accessing
  members of a vector or appending elements can be done in <a href=
  "../complexity.html">constant time</a>, whereas locating a specific
  value or inserting elements into the vector takes <a href=
  "../complexity.html">linear time</a>.</p>

  <p><a href="all.html">Display all entries</a> for C++ Vectors on one
  page, or view entries individually:</p>

  <table class="category-table">
    <tr class="category-table-tr-2">
      <td class="category-table-td"><a href=
      "vector_constructors.html">Vector constructors</a></td>

      <td class="category-table-td">create vectors and initialize them
      with some data</td>
    </tr>

    <tr class="category-table-tr-1">
      <td class="category-table-td"><a href=
      "vector_operators.html">Vector operators</a></td>

      <td class="category-table-td">compare, assign, and access
      elements of a vector</td>
    </tr>

    <tr class="category-table-tr-2">
      <td class="category-table-td"><a href=
      "assign.html">assign</a></td>

      <td class="category-table-td">assign elements to a vector</td>
    </tr>

    <tr class="category-table-tr-1">
      <td class="category-table-td"><a href="at.html">at</a></td>

      <td class="category-table-td">returns an element at a specific
      location</td>
    </tr>

    <tr class="category-table-tr-2">
      <td class="category-table-td"><a href="back.html">back</a></td>

      <td class="category-table-td">returns a reference to last element
      of a vector</td>
    </tr>

    <tr class="category-table-tr-1">
      <td class="category-table-td"><a href="begin.html">begin</a></td>

      <td class="category-table-td">returns an iterator to the
      beginning of the vector</td>
    </tr>

    <tr class="category-table-tr-2">
      <td class="category-table-td"><a href=
      "capacity.html">capacity</a></td>

      <td class="category-table-td">returns the number of elements that
      the vector can hold</td>
    </tr>

    <tr class="category-table-tr-1">
      <td class="category-table-td"><a href="clear.html">clear</a></td>

      <td class="category-table-td">removes all elements from the
      vector</td>
    </tr>

    <tr class="category-table-tr-2">
      <td class="category-table-td"><a href="empty.html">empty</a></td>

      <td class="category-table-td">true if the vector has no
      elements</td>
    </tr>

    <tr class="category-table-tr-1">
      <td class="category-table-td"><a href="end.html">end</a></td>

      <td class="category-table-td">returns an iterator just past the
      last element of a vector</td>
    </tr>

    <tr class="category-table-tr-2">
      <td class="category-table-td"><a href="erase.html">erase</a></td>

      <td class="category-table-td">removes elements from a vector</td>
    </tr>

    <tr class="category-table-tr-1">
      <td class="category-table-td"><a href="front.html">front</a></td>

      <td class="category-table-td">returns a reference to the first
      element of a vector</td>
    </tr>

    <tr class="category-table-tr-2">
      <td class="category-table-td"><a href=
      "insert.html">insert</a></td>

      <td class="category-table-td">inserts elements into the
      vector</td>
    </tr>

    <tr class="category-table-tr-1">
      <td class="category-table-td"><a href=
      "max_size.html">max_size</a></td>

      <td class="category-table-td">returns the maximum number of
      elements that the vector can hold</td>
    </tr>

    <tr class="category-table-tr-2">
      <td class="category-table-td"><a href=
      "pop_back.html">pop_back</a></td>

      <td class="category-table-td">removes the last element of a
      vector</td>
    </tr>

    <tr class="category-table-tr-1">
      <td class="category-table-td"><a href=
      "push_back.html">push_back</a></td>

      <td class="category-table-td">add an element to the end of the
      vector</td>
    </tr>

    <tr class="category-table-tr-2">
      <td class="category-table-td"><a href=
      "rbegin.html">rbegin</a></td>

      <td class="category-table-td">returns a <a href=
      "../iterators.html">reverse_iterator</a> to the end of the
      vector</td>
    </tr>

    <tr class="category-table-tr-1">
      <td class="category-table-td"><a href="rend.html">rend</a></td>

      <td class="category-table-td">returns a <a href=
      "../iterators.html">reverse_iterator</a> to the beginning of the
      vector</td>
    </tr>

    <tr class="category-table-tr-2">
      <td class="category-table-td"><a href=
      "reserve.html">reserve</a></td>

      <td class="category-table-td">sets the minimum capacity of the
      vector</td>
    </tr>

    <tr class="category-table-tr-1">
      <td class="category-table-td"><a href=
      "resize.html">resize</a></td>

      <td class="category-table-td">change the size of the vector</td>
    </tr>

    <tr class="category-table-tr-2">
      <td class="category-table-td"><a href="size.html">size</a></td>

      <td class="category-table-td">returns the number of items in the
      vector</td>
    </tr>

    <tr class="category-table-tr-1">
      <td class="category-table-td"><a href="swap.html">swap</a></td>

      <td class="category-table-td">swap the contents of this vector
      with another</td>
    </tr>
  </table>
  </div>
  </td>
  


  </tr>
  </table>
</body></html>
